libxl: fix memory map reported to PVH guests
authorRoger Pau Monne <roger.pau@citrix.com>
Fri, 20 Apr 2018 14:57:19 +0000 (15:57 +0100)
committerWei Liu <wei.liu2@citrix.com>
Mon, 23 Apr 2018 13:31:05 +0000 (14:31 +0100)
commitdf1ca1dfe20f476b9ab461efc59304a7bf1af9b2
treec126780b10da5389a1e652528385cf9b9d5a0915
parent8717e7417cebeae162fd61ea4cbdcdd422748f08
libxl: fix memory map reported to PVH guests

PVH guests with 4GB of RAM or more get a memory map like the
following:

0x00000000000000 - 0x000000fee00000 RAM
0x000000fee00000 - 0x00000100000000 RESERVED
0x000000fc009000 - 0x000000fc009040 ACPI
0x000000fc000000 - 0x000000fc001000 ACPI
0x000000fc001000 - 0x000000fc009000 ACPI
0x00000100000000 - 0x000001fb200400 RAM

This is wrong because ACPI regions overlap with RAM regions. The cause
of this issue is not setting a big enough MMIO hole and marking the
whole MMIO hole as reserved, when it actually contains several pieces:

 - local APIC page.
 - ACPI tables.
 - HVM special pages.

Of those items only HVM special pages need to be marked as reserved in
order to advise the guest against using them for example for memory
hotplug.

After the fix the layout reported for the same guest is:

0x00000000000000 - 0x000000fc000000 RAM
0x000000feff8000 - 0x000000ff000000 RESERVED
0x000000fc009000 - 0x000000fc009040 ACPI
0x000000fc000000 - 0x000000fc001000 ACPI
0x000000fc001000 - 0x000000fc009000 ACPI
0x00000100000000 - 0x000001fe000400 RAM

Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
Release-acked-by: Juergen Gross <jgross@suse.com>
Acked-by: Wei Liu <wei.liu2@citrix.com>
tools/libxl/libxl_arch.h
tools/libxl/libxl_dom.c
tools/libxl/libxl_x86.c
tools/libxl/libxl_x86_acpi.c